#ifndef QDATAPANEL_H
#define QDATAPANEL_H

#include <QWidget>

#include <QTreeWidget>
#include <QLabel>

#define PAGE_MAX 100

class StyledBar;
class QSqlQuery;

class QDataPanel : public QWidget
{
    Q_OBJECT
public:
    explicit QDataPanel(QWidget *parent = 0);
    
    void    set_text(const QString &text);
    QString text();

    void    set_query(QSqlQuery* query);

    void    clear();

    void    show_page(int index);
signals:
    void    first_enabled(bool enabled);
    void    prev_enabled(bool enabled);
    void    next_enabled(bool enabled);
    void    last_enabled(bool enabled);
protected slots:
    void    next();
    void    prev();
    void    first();
    void    last();
protected:
    QTreeWidget     *m_tree_widget;
    QLabel          *m_label;
    StyledBar       *m_styledbar;
    QSqlQuery       *m_query;
    int             m_page_index;
    int             m_size;
    QLabel          *m_page_number_label;
};

#endif // QDATAPANEL_H
